package com.vrp3d.common.context;

import com.vrp3d.domain.model.UserContext;

/**
 * 获取用户上下文
 *
 * @author vrp3d
 */
public class InvokerContext extends AbstractContext {

    /**
     * 用户上下文
     */
    private static ThreadLocal<UserContext> USER_CTX = new ThreadLocal<>();

//    public static final String _USER_CTX_KEY = "_USER_CTX";

    private InvokerContext() {
    }

    public static void setUserCtx(UserContext userCtx) {
        clear();
        USER_CTX.set(userCtx);
    }

    public static UserContext getUserCtx() {
        return USER_CTX.get();
    }


    public static void clear() {
        USER_CTX.remove();
    }


}
